<template>
  <div id="app">
    <keep-alive>
        <router-view/>
    </keep-alive>
  </div>
</template>
<script>
export default {
  mounted() {
    window.onload=function () {
      document.addEventListener('touchstart',function (event) {
        if(event.touches.length>1){
          event.preventDefault();
        }
      });
      var lastTouchEnd=0;
      document.addEventListener('touchend',function (event) {
        var now=(new Date()).getTime();
        if(now-lastTouchEnd<=300){
          event.preventDefault();
        }
        lastTouchEnd=now;
      },false);
      document.addEventListener('gesturestart', function (event) {
        event.preventDefault();
      });
    }
  },
    created() {
        console.log('this.$route.query', this.$route.query)
        // const screenWidth = this.$route.query.screenWidth || 375
        // const screenHeight = this.$route.query.screenHeight || 700
        const screenWidth = window.screen.width
        const screenHeight = window.screen.height
        let width = screenWidth - 20 + 20
        let height = width * 1.48
        if (height >= screenHeight - 180 ) {
            height = screenHeight - 180
            width = (height + 20) / 1.48 - 20 + 20
        }

        localStorage.setItem('width', width)
        localStorage.setItem('height', height)
    }
}
</script>
<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}

#nav {
  padding: 30px;
}

#nav a {
  font-weight: bold;
  color: #2c3e50;
}

#nav a.router-link-exact-active {
  color: #42b983;
}

</style>
